package com.zmn.plat.common.dictionary;

/**
 * 渠道预收限制
 *
 * @author xiangjunming
 * @since 2020/03/26 14:56:30
 */
@Deprecated
public enum ChannelAdvanceLimitEnum {

    /**
     * values
     */
    COMPANY(ChannelAdvanceLimitEnum.CONSTS_COMPANY, "公司预收"),
    CHANNEL(ChannelAdvanceLimitEnum.CONSTS_CHANNEL, "渠道预收"),
    NOT(ChannelAdvanceLimitEnum.CONSTS_NOT, "无预收"),
    ;

    /**
     * 渠道预收限制：1.公司
     */
    public final static int CONSTS_COMPANY = 1;
    /**
     * 渠道预收限制：2.渠道
     */
    public final static int CONSTS_CHANNEL = 2;
    /**
     * 渠道预收限制：3.无
     */
    public final static int CONSTS_NOT = 3;

    private Integer code;
    private String name;

    ChannelAdvanceLimitEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static ChannelAdvanceLimitEnum of(Integer code) {
        if (code == null) {
            return null;
        }
        switch (code) {
            case 1:
                return COMPANY;
            case 2:
                return CHANNEL;
            case 3:
                return NOT;
            default:
                return null;
        }
    }

    public static String getName(Integer code) {
        ChannelAdvanceLimitEnum of = of(code);
        return of == null ? null : of.getName();
    }
}
